/*
 *  Copyright (c) Iris Dev. team. All rights reserved.
 *  See http://www.communico.pro/license for details.
 *
 */
#include <stdio.h>

#include "ASConsistentHash.hpp"

using namespace CAS_MOD;

int main(int argc, char ** argv)
{
	ConsistentHash<INT_32> oHash(10);

	oHash.AddElement("Foo", 10, 2.0);
	oHash.AddElement("Bar", 20, 1.0);
	oHash.AddElement("Baz", 30, 2.0);

	INT_32 iElement = 0;
	oHash.GetElement("Foo", iElement);
	fprintf(stderr, "Element: %d\n", iElement);
	oHash.GetElement("Bar", iElement);
	fprintf(stderr, "Element: %d\n", iElement);
	oHash.GetElement("Baz", iElement);
	fprintf(stderr, "Element: %d\n\n", iElement);

	oHash.DisableElement("Foo");

	oHash.GetElement("Foo", iElement);
	fprintf(stderr, "Element: %d\n", iElement);
	oHash.GetElement("Bar", iElement);
	fprintf(stderr, "Element: %d\n", iElement);
	oHash.GetElement("Baz", iElement);
	fprintf(stderr, "Element: %d\n\n", iElement);

	oHash.EnableElement("Foo");

	oHash.GetElement("Foo", iElement);
	fprintf(stderr, "Element: %d\n", iElement);
	oHash.GetElement("Bar", iElement);
	fprintf(stderr, "Element: %d\n", iElement);
	oHash.GetElement("Baz", iElement);
	fprintf(stderr, "Element: %d\n\n", iElement);

return 0;
}
// End.
